package wechat.app;

import org.eclipse.xtext.xbase.lib.InputOutput;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.json.JSONObject;
import org.junit.Ignore;
import org.junit.Test;
import wechat.app.WXServiceAppFactoryDemo;
import wechat.base.snd.WCButton;
import wechat.base.snd.WCMenu;
import wechat.base.snd.WCServiceApp;
import wechat.base.snd.WCSubButton;

@SuppressWarnings("all")
public class CreateMenuTest {
  @Test
  @Ignore
  public void deletemenu() {
    WCServiceApp _serviceApp = WXServiceAppFactoryDemo.getServiceApp();
    final Procedure1<WCServiceApp> _function = new Procedure1<WCServiceApp>() {
      public void apply(final WCServiceApp it) {
        it.deleteMenu();
      }
    };
    ObjectExtensions.<WCServiceApp>operator_doubleArrow(_serviceApp, _function);
  }
  
  @Test
  @Ignore
  public void testCreateMenu() {
    final String SERVICE_APP_TASK_HISTORY_URL = "http://operation.linemore.com/taskhistory";
    final String SERVICE_APP_TASK_STAT_URL = "http://operation.linemore.com/taskstat";
    final WCServiceApp app = WXServiceAppFactoryDemo.getServiceApp();
    WCMenu _wCMenu = new WCMenu();
    final Procedure1<WCMenu> _function = new Procedure1<WCMenu>() {
      public void apply(final WCMenu it) {
        WCButton _createBtn = it.createBtn();
        final Procedure1<WCButton> _function = new Procedure1<WCButton>() {
          public void apply(final WCButton it) {
            it.setName("客户服务");
            WCSubButton _wCSubButton = new WCSubButton();
            final Procedure1<WCSubButton> _function = new Procedure1<WCSubButton>() {
              public void apply(final WCSubButton it) {
                it.setType("view");
                it.setName("报修历史");
                String _buildAuthConnection = app.buildAuthConnection(SERVICE_APP_TASK_HISTORY_URL, "111");
                it.setUrl(_buildAuthConnection);
              }
            };
            WCSubButton _doubleArrow = ObjectExtensions.<WCSubButton>operator_doubleArrow(_wCSubButton, _function);
            it.withSubButton(_doubleArrow);
            WCSubButton _wCSubButton_1 = new WCSubButton();
            final Procedure1<WCSubButton> _function_1 = new Procedure1<WCSubButton>() {
              public void apply(final WCSubButton it) {
                it.setType("view");
                it.setName("月度报修统计");
                String _buildAuthConnection = app.buildAuthConnection(SERVICE_APP_TASK_STAT_URL, "1");
                it.setUrl(_buildAuthConnection);
              }
            };
            WCSubButton _doubleArrow_1 = ObjectExtensions.<WCSubButton>operator_doubleArrow(_wCSubButton_1, _function_1);
            it.withSubButton(_doubleArrow_1);
            WCSubButton _wCSubButton_2 = new WCSubButton();
            final Procedure1<WCSubButton> _function_2 = new Procedure1<WCSubButton>() {
              public void apply(final WCSubButton it) {
                it.setType("view");
                it.setName("月度故障统计");
                String _buildAuthConnection = app.buildAuthConnection(SERVICE_APP_TASK_STAT_URL, "2");
                it.setUrl(_buildAuthConnection);
              }
            };
            WCSubButton _doubleArrow_2 = ObjectExtensions.<WCSubButton>operator_doubleArrow(_wCSubButton_2, _function_2);
            it.withSubButton(_doubleArrow_2);
          }
        };
        WCButton _doubleArrow = ObjectExtensions.<WCButton>operator_doubleArrow(_createBtn, _function);
        it.withButton(_doubleArrow);
        WCButton _createBtn_1 = it.createBtn();
        final Procedure1<WCButton> _function_1 = new Procedure1<WCButton>() {
          public void apply(final WCButton it) {
            it.setName("蓝盟优势");
            WCSubButton _wCSubButton = new WCSubButton();
            final Procedure1<WCSubButton> _function = new Procedure1<WCSubButton>() {
              public void apply(final WCSubButton it) {
                it.setType("view");
                it.setName("10+司龄员工多");
                it.setUrl("http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461790&idx=1&sn=caa4537cfb280ad66d6b36b35b2016ea&scene=18#rd");
              }
            };
            WCSubButton _doubleArrow = ObjectExtensions.<WCSubButton>operator_doubleArrow(_wCSubButton, _function);
            it.withSubButton(_doubleArrow);
            WCSubButton _wCSubButton_1 = new WCSubButton();
            final Procedure1<WCSubButton> _function_1 = new Procedure1<WCSubButton>() {
              public void apply(final WCSubButton it) {
                it.setType("view");
                it.setName("99.98%到场");
                it.setUrl("http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461794&idx=1&sn=fadd72b39baef928c9e0df62b9641c3d&scene=18#rd");
              }
            };
            WCSubButton _doubleArrow_1 = ObjectExtensions.<WCSubButton>operator_doubleArrow(_wCSubButton_1, _function_1);
            it.withSubButton(_doubleArrow_1);
            WCSubButton _wCSubButton_2 = new WCSubButton();
            final Procedure1<WCSubButton> _function_2 = new Procedure1<WCSubButton>() {
              public void apply(final WCSubButton it) {
                it.setType("view");
                it.setName("16+保安全");
                it.setUrl("http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461840&idx=1&sn=260d6be5acf92bcb558d171993dc0f6b&scene=18#rd");
              }
            };
            WCSubButton _doubleArrow_2 = ObjectExtensions.<WCSubButton>operator_doubleArrow(_wCSubButton_2, _function_2);
            it.withSubButton(_doubleArrow_2);
            WCSubButton _wCSubButton_3 = new WCSubButton();
            final Procedure1<WCSubButton> _function_3 = new Procedure1<WCSubButton>() {
              public void apply(final WCSubButton it) {
                it.setType("view");
                it.setName("1000+客户");
                it.setUrl("http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461843&idx=1&sn=a8c038737c5f45427a21fb56e8e89d74&scene=18#rd");
              }
            };
            WCSubButton _doubleArrow_3 = ObjectExtensions.<WCSubButton>operator_doubleArrow(_wCSubButton_3, _function_3);
            it.withSubButton(_doubleArrow_3);
            WCSubButton _wCSubButton_4 = new WCSubButton();
            final Procedure1<WCSubButton> _function_4 = new Procedure1<WCSubButton>() {
              public void apply(final WCSubButton it) {
                it.setType("view");
                it.setName("300+专职员工");
                it.setUrl("http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461846&idx=1&sn=f16ab55ea1d7859bfac7f8f29975fed1&scene=18#rd");
              }
            };
            WCSubButton _doubleArrow_4 = ObjectExtensions.<WCSubButton>operator_doubleArrow(_wCSubButton_4, _function_4);
            it.withSubButton(_doubleArrow_4);
          }
        };
        WCButton _doubleArrow_1 = ObjectExtensions.<WCButton>operator_doubleArrow(_createBtn_1, _function_1);
        it.withButton(_doubleArrow_1);
        WCButton _createBtn_2 = it.createBtn();
        final Procedure1<WCButton> _function_2 = new Procedure1<WCButton>() {
          public void apply(final WCButton it) {
            it.setName("推荐服务");
            WCSubButton _wCSubButton = new WCSubButton();
            final Procedure1<WCSubButton> _function = new Procedure1<WCSubButton>() {
              public void apply(final WCSubButton it) {
                it.setType("view");
                it.setName("应急服务");
                it.setUrl("http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461953&idx=1&sn=e94f048b0212ed99a0240e763a734a05&scene=18#rd");
              }
            };
            WCSubButton _doubleArrow = ObjectExtensions.<WCSubButton>operator_doubleArrow(_wCSubButton, _function);
            it.withSubButton(_doubleArrow);
            WCSubButton _wCSubButton_1 = new WCSubButton();
            final Procedure1<WCSubButton> _function_1 = new Procedure1<WCSubButton>() {
              public void apply(final WCSubButton it) {
                it.setType("view");
                it.setName("派驻服务");
                it.setUrl("http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461964&idx=1&sn=fc6478fb12815e97435a41c0d569bb65&scene=18#rd");
              }
            };
            WCSubButton _doubleArrow_1 = ObjectExtensions.<WCSubButton>operator_doubleArrow(_wCSubButton_1, _function_1);
            it.withSubButton(_doubleArrow_1);
            WCSubButton _wCSubButton_2 = new WCSubButton();
            final Procedure1<WCSubButton> _function_2 = new Procedure1<WCSubButton>() {
              public void apply(final WCSubButton it) {
                it.setType("view");
                it.setName("远程服务");
                it.setUrl("http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461975&idx=1&sn=1d2902be75ca92ff062b753113da2c32&scene=18#rd");
              }
            };
            WCSubButton _doubleArrow_2 = ObjectExtensions.<WCSubButton>operator_doubleArrow(_wCSubButton_2, _function_2);
            it.withSubButton(_doubleArrow_2);
            WCSubButton _wCSubButton_3 = new WCSubButton();
            final Procedure1<WCSubButton> _function_3 = new Procedure1<WCSubButton>() {
              public void apply(final WCSubButton it) {
                it.setType("view");
                it.setName("IT采购");
                it.setUrl("http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461986&idx=1&sn=eb1e04e5e1baa73c0cc1a250d1f9eca5&scene=18#rd");
              }
            };
            WCSubButton _doubleArrow_3 = ObjectExtensions.<WCSubButton>operator_doubleArrow(_wCSubButton_3, _function_3);
            it.withSubButton(_doubleArrow_3);
            WCSubButton _wCSubButton_4 = new WCSubButton();
            final Procedure1<WCSubButton> _function_4 = new Procedure1<WCSubButton>() {
              public void apply(final WCSubButton it) {
                it.setType("view");
                it.setName("组网服务");
                it.setUrl("http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200463160&idx=1&sn=fc0a1b7936f2014fbc4c14e1699f68b1&scene=18#rd\"");
              }
            };
            WCSubButton _doubleArrow_4 = ObjectExtensions.<WCSubButton>operator_doubleArrow(_wCSubButton_4, _function_4);
            it.withSubButton(_doubleArrow_4);
          }
        };
        WCButton _doubleArrow_2 = ObjectExtensions.<WCButton>operator_doubleArrow(_createBtn_2, _function_2);
        it.withButton(_doubleArrow_2);
      }
    };
    final WCMenu m = ObjectExtensions.<WCMenu>operator_doubleArrow(_wCMenu, _function);
    JSONObject _build = m.build();
    String _string = _build.toString();
    InputOutput.<String>println(_string);
    app.createMenu(m);
  }
  
  @Test
  @Ignore
  public void testGetMenuInfo() {
    WCServiceApp _serviceApp = WXServiceAppFactoryDemo.getServiceApp();
    final Procedure1<WCServiceApp> _function = new Procedure1<WCServiceApp>() {
      public void apply(final WCServiceApp it) {
        String _menuInfo = it.getMenuInfo();
        InputOutput.<String>println(_menuInfo);
      }
    };
    ObjectExtensions.<WCServiceApp>operator_doubleArrow(_serviceApp, _function);
  }
}
